﻿#include "stdafx.h"
#include "String.h"

 

String::String(const char* _Format, ... )
{
	char temp [2048];
	temp[0] = '\0';
	
	va_list ap;
	va_start( ap, _Format );
	vsprintf( temp, _Format, ap ); // vsprintf ?
	va_end( ap );
	
	assign(temp);
}

void String::AssignF(const char* _Format, ... )
{
	char temp [2048];
	temp[0] = '\0';

	va_list ap;
	va_start( ap, _Format );
	vsprintf( temp, _Format, ap ); // vsprintf ?
	va_end( ap );
 
	assign(temp);	
}

void String::AppendF(const char* _Format, ... )
{
	char temp [2048];
	temp[0] = '\0';
 
	va_list ap;
	va_start( ap, _Format );
	vsprintf( temp, _Format, ap ); // vsprintf ?
	va_end( ap );
 
	append(temp);	
}
   
void String::operator += (bool value)
{
	if(value)
	{
		append("true");
		return;
	}

	append("false");
}

void String::operator += (int value)
{
	char temp[32];
	sprintf( temp, "%i", value );
	append( temp );
}

void String::operator += (float value)
{
	char temp[64];
	sprintf( temp, "%f", value );
	append( temp );
}




